/*
 * StringParameter.java July 2009
 *
 * Copyright (C) 2009, Quirino Zagarese <quirino@laszloitalia.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA  02111-1307  USA
 */
package org.eu4ria.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.eu4ria.enums.RegexPatterns;


/**
 * This lets you define the format of the string argument of an
 * {@link Action} annotated method. You can use acceptPattern with the {@link RegexPatterns}
 * enum to choose among a list of predefined patterns, or you can use customPattern to
 * insert a custom regular expression.
 *
 * <pre>
 *
 * [at]Action
 * public void setNewString(
 * 	[at]StringParameter(acceptPattern=RegexPatterns.WORD_CHARS, exceptChars="12abc",
 * 		minlength=5, maxlength=10)String newString){
 * 	this.oldString = newString;
 * }
 *
 * </pre>
 *
 * @see org.eu4ria.enums.RegexPatterns
 * @author Quirino Zagarese
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface StringParameter {


	/**
	 * A regular expression pattern choosed among the items in {@link RegexPatterns}
	 *
	 *
	 */
	public RegexPatterns acceptPattern() default RegexPatterns.ANY;


	/**
	 * A string representing the chars you don't want to be accepted
	 * as part of the string argument
	 *
	 *
	 */
	public String exceptChars() default "";

	/**
	 * A custom regular expression to define the acceptable values for
	 * the string argument
	 *
	 *
	 */
	public String customPattern() default "";

	/**
	 * The minimum length of the string argument
	 *
	 *
	 */
	public int minlength() default 0;

	/**
	 * The maximum length of the string argument
	 *
	 *
	 */
	public int maxlength() default Integer.MAX_VALUE;


}
